import {createRouter, createWebHistory} from 'vue-router'
import type {App} from "vue";
import {staticRoutes} from "@/router/routers/staticRoutes.ts";
import { configureNProgress } from './utils/utils'

export const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: staticRoutes
})

// 初始化路由
export function initRouter(app: App<Element>): void {
    configureNProgress() // 顶部进度条
    // setupBeforeEachGuard(router) // 路由前置守卫
    // setupAfterEachGuard(router) // 路由后置守卫
    app.use(router)
}
